"""
ExpectResult, returned by expect()

Copyright (c) 2009 Christopher Hesse
http://code.google.com/p/python-expect/
"""

class ExpectResult(object):
    def __init__(self, name, index, channel, buffer_before, match, buffer_after, match_object):
        self.name = name
        self.index = index
        self.channel = channel
        self.buffer_before = buffer_before
        self.match = match
        self.buffer_after = buffer_after
        self.match_object = match_object
        
    def __eq__(self, other):
        return self.name == other
        
    def __repr__(self):
        return ("<ExpectResult name='{name}' index={index} channel={channel}" +
                " match='{match}' buffer_before='{buffer_before}' buffer_after='{buffer_after}'" +
                " match_object='{match_object}'>").format(name=self.name, index=self.index,
                channel=self.channel, match=repr(self.match), buffer_before=repr(self.buffer_before),
                buffer_after=repr(self.buffer_after), match_object=self.match_object)